package com.example.star.api_service;

import com.example.star.entity.Perimeter;
import com.example.star.entity.User;

import java.math.BigDecimal;

import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface ApiUser {
    @FormUrlEncoded
    @POST("/register")
    Call<User> register(@Field("username") String username,@Field("nickname") String nickname,@Field("password") String password);
    @FormUrlEncoded
    @POST("/login")
    Call<User> login(@Field("username") String username, @Field("password") String password);


    // 根据用户名查询用户数据
    @GET("users_by_username")
    Call<User> getUserByUsername(@Query("username") String username);

    // 根据用户名更改用户数据
    @FormUrlEncoded
    @PUT("update_by_username")
    Call<User> updateUserByUsername(@Field("username") String username, @Field("password") String password, @Field("nickname") String nickname
    );

    @FormUrlEncoded
    @PUT("update/avatar")
    Call<User> changeAvatar(@Field("username") String username, @Field("avatar") String avatar);


    @FormUrlEncoded
    @PUT("update/password")
    Call<User> changePassword(@Field("username") String username, @Field("oldPassword") String oldPassword, @Field("newPassword") String newPassword);

    @FormUrlEncoded
    @POST("update/recharge")
    Call<String> recharge(@Field("username") String username, @Field("amount") double amount);

    @FormUrlEncoded
    @POST("pay")
    Call<User> pay(@Field("username") String username, @Field("money") BigDecimal money);

    // 添加检测余额的方法
    @FormUrlEncoded
    @POST("checkMoney")
    Call<BigDecimal> checkMoney(@Field("username") String username);
}
